<?php

class TournamentCategory extends Model {
	
	private $_ClassId;
	private $_Description;
	
	public function setClassId($value){
		$this->_ClassId = $value;
	}
	
	public function setDescription($value){
		$this->_Description = $value;
	}
	
	public function getClassId(){
		return $this->_ClassId;
	}
	
	public function getDescription(){
		return $this->_Description;
	}

	public function __construct($arrInitialValues = null) {
		parent::__construct ();
	
		if (isset($arrInitialValues['class_id']))
			$this->setClassId($arrInitialValues['class_id']);
		else
			$this->setClassId(0);
			
		if (isset($arrInitialValues['description']))
			$this->setDescription($arrInitialValues['description']);
		else
			$this->setDescription('');
	}
	
	public function getClass(){
		$query = '
			SELECT *
			FROM class
			WHERE class_id = ' . $this->getClassId();
		
		$dbHelper = new DBHelper($query);
		return $dbHelper->getResult();
	}
	
	public static function getAll(){
		parent::requireDB();
		$query = '
			SELECT *
			FROM class';
		
		$dbHelper = new DBHelper($query);
		return $dbHelper->getResult();		
	}
}

?>